<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>Flotr: Basic Legend Example</title>
		<link rel="stylesheet" href="style.css" type="text/css" />
		<script type="text/javascript" src="./flotr/lib/excanvas.js"></script>
		<script type="text/javascript" src="./flotr/lib/prototype-1.6.0.2.js"></script>
		<script type="text/javascript" src="./flotr/flotr-0.2.0-alpha.js"></script>
		<style type="text/css">
			.flotr-legend{
				border: 2px solid #B6D9FF;
			}			
		</style>
		</head>
	<body>

			<div id="container" style="width:600px;height:240px;"></div>
			
		<script type="text/javascript">
			/**
			 * Wait till dom's finished loading.
			 */
			document.observe('dom:loaded', function(){
				/**
				 * Fill series d1 and d2.
				 */
				var d1 = [];
				var d2 = [];
				var d3 = [];
			    for(var i = 0; i < 15; i += 0.5){
			        d1.push([i, i + Math.sin(i+Math.PI)]);
					d2.push([i, i]);
					d3.push([i, 15-Math.cos(i)]);
				}
			
				/**
				 * This function prepend each label with 'y = '.
				 */
				function myLabelFunc(label){
					return 'y = ' + label;
				}
			
				/**
				 * Draw the graph.
				 */
			    var f = Flotr.draw(
					$('container'), [ 
						{data:d1, label:'x + sin(x+&pi;)'},
						{data:d2, label:'x'},
						{data:d3, label:'15 - cos(x)'}											
					],{
						legend:{
							position: 'se', // => position the legend 'south-east'.
							backgroundColor: '#D2E8FF' // => a light blue background color.
						}
					}
				);
			});	
						
		</script>
		<script>
		var d1=[];
		var m;
		m=1;
		function myLabelFunc(label){
					return 'y = ' + label;
				}
		function donew()
		{
			
			//for(m=1;m<24*60;m++)
				d1.push(["21.09",Math.random()]);
				d1.push(["21.10",Math.random()]);
				d1.push(["21.11",Math.random()]);
				d1.push(["21.12",Math.random()]);
		
	
			var f1 = Flotr.draw(
					$('container'), [ 
						{data:d1, label:'x + sin(x+&pi;)'}									
					],{
						legend:{
							position: 'se', // => position the legend 'south-east'.
							labelFormatter: myLabelFunc, // => format the labels.
							backgroundColor: '#D2E8FF' // => a light blue background color.
						}
					}
				);
			
		}
		</script>
		<input type="button" onClick="donew()" value="aaaaa">
		
	</body>
</html>
